//
//  ZYCWisdomProtalDetailHeaderView.m
//  ZDSC
//
//  Created by ZDTX on 2021/8/18.
//

#import "ZYCWisdomProtalDetailHeaderView.h"
#import "ZYCNewBulletinModel.h"
@interface ZYCWisdomProtalDetailHeaderView ()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *nameLabel;
@end
@implementation ZYCWisdomProtalDetailHeaderView

- (void)setModel:(ZYCNewBulletinModel *)model{
    _model = model;
    _titleLabel.text = model.title;
    _timeLabel.text = model.createTime;
    _nameLabel.text = model.publisher;


}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.timeLabel];
        [self addSubview:self.nameLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.5f);
            make.right.equalTo(self).offset(-15.5f);
            make.top.equalTo(self).offset(20.0f);
        }];
        
        [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15.5f);
            make.top.equalTo(self.titleLabel.mas_bottom).offset(20.0f);
            make.bottom.equalTo(self).offset(-20.0f);
        }];
        
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self).offset(-15.5f);
            make.centerY.equalTo(self.timeLabel);
        }];
    }
    return self;
}


- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithFont:kSystemBoldFont(17.0f) titleColor:HEX_RGB(@"#2B302D") textAlignment:ZZTextAlignmentLeft];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14.0f) titleColor:HEX_RGB(@"#939393") textAlignment:ZZTextAlignmentLeft];
    }
    return _timeLabel;
}

- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [UILabel LabelWithFont:kCustomFont(@"PingFangSC-Light", 14.0f) titleColor:HEX_RGB(@"#939393") textAlignment:ZZTextAlignmentRight];
    }
    return _nameLabel;
}
@end
